package com.nopay.cdxphone.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;

import androidx.annotation.NonNull;

import com.nopay.cdxphone.R;

public class DialogMemberTrial extends Dialog {

    public DialogMemberTrial(@NonNull Activity context) {
        super(context, R.style.MyDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_member_trial);
        setCanceledOnTouchOutside(false);

        findViewById(R.id.tv_dialog_cancel).setOnClickListener(v -> {
            dismiss();
            if(onMemberTrialListener != null) onMemberTrialListener.onMemberTrial(false);
        });
        findViewById(R.id.tv_dialog_confirm).setOnClickListener(v -> {
            dismiss();
            if(onMemberTrialListener != null) onMemberTrialListener.onMemberTrial(true);
        });
    }

    private OnMemberTrialListener onMemberTrialListener;

    public DialogMemberTrial setOnMemberTrialListener(OnMemberTrialListener onMemberTrialListener) {
        this.onMemberTrialListener = onMemberTrialListener;
        return this;
    }

    public interface OnMemberTrialListener {

        void onMemberTrial(boolean confirm);
    }
}
